package cn.ljy.uem.web.action.backstage.school;

import cn.hutool.core.io.FileUtil;
import cn.hutool.poi.excel.ExcelWriter;
import cn.ljy.authority.web.controller.backstage.BaseBackstageController;
import cn.ljy.common.exception.model.MyWebException;
import cn.ljy.common.model.result.ResponseData;
import cn.ljy.common.utils.file.MyFileUpload;
import cn.ljy.common.utils.table.MyTableUtil;
import cn.ljy.uem.model.SchoolClass;
import cn.ljy.uem.model.SchoolGrade;
import cn.ljy.uem.model.query.SchoolClassQuery;
import cn.ljy.uem.model.query.SchoolGradeQuery;
import cn.ljy.uem.service.SchoolClassService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;


/**
 * @author 廖振豪
 * @description 行政班模块的业务层接口
 * @date 2022-7-6 10:45
 */
@Api(tags = "后台的行政班模块")
@RestController
@RequestMapping(value = "/api/backstage/school/schoolclass")
public class SchoolClassController extends BaseBackstageController<SchoolClass, SchoolClassQuery, Integer> {

    @Autowired
    private SchoolClassService baseService;

    @ApiOperation(value = "查询所有行政班")
//    @PreAuthorize("hasAuthority('sys:schoolclass:query')")
    @GetMapping("/all")
    @Override
    protected ResponseData query(SchoolClassQuery query) {
        return super.query(query);
    }

//    @ApiOperation(value = "分页查询行政班列表")
//    @PreAuthorize("hasAuthority('sys:schoolclass:query')")
//    @Override
//    public ResponseData query(Integer page, Integer pageSize, SchoolGradeQuery query){
//        return super.query(page,pageSize,query);
//    }

    @ApiOperation(value = "读取行政班信息")
//    @PreAuthorize("hasAuthority('sys:schoolclass:query')")
    @Override
    protected ResponseData get(@PathVariable("id") Integer id) {
        return super.get(id);
    }

    @ApiOperation(value = "批量删除指定的多个行政班")
//    @PreAuthorize("hasAuthority('sys:schoolclass:del')")
    @Override
    protected ResponseData deletes(@NotEmpty(message = "操作失败：请选择要移除的记录") Integer[] ids) {
        return super.deletes(ids);
    }


    @ApiOperation(value = "添加行政班")
//    @PreAuthorize("hasAuthority('sys:schoolclass:add')")
    @Override
    protected ResponseData add(@Valid @RequestBody SchoolClass schoolClass) {
        return super.add(schoolClass);
    }

    @ApiOperation(value = "编辑行政班")
//    @PreAuthorize("hasAuthority('sys:schoolclass:edit')")
    @Override
    protected ResponseData edit(@Valid @RequestBody SchoolClass schoolClass) {
        return super.edit(schoolClass);
    }


}
